package com.kool.evowkf.bean.io.approve;

import com.kool.core.base.BaseBean;
import com.kool.core.exception.AppException;
import com.kool.core.util.StringUtils;
import com.kool.core.validate.IIoValidate;

/**
 * @AUTHOR LUYU
 */
public class CMUPDAPRENTITYXBean extends BaseBean implements IIoValidate {
	protected String entityCid;
	protected String entityName;
	protected String wkfCode;
	protected String businessType;
	protected String matchValue;

	public String getEntityCid() {
		return entityCid;
	}

	public void setEntityCid(String entityCid) {
		this.entityCid = entityCid;
	}

	public String getEntityName() {
		return entityName;
	}

	public void setEntityName(String entityName) {
		this.entityName = entityName;
	}

	public String getWkfCode() {
		return wkfCode;
	}

	public void setWkfCode(String wkfCode) {
		this.wkfCode = wkfCode;
	}

	public String getBusinessType() {
		return businessType;
	}

	public void setBusinessType(String businessType) {
		this.businessType = businessType;
	}

	public String getMatchValue() {
		return matchValue;
	}

	public void setMatchValue(String matchValue) {
		this.matchValue = matchValue;
	}

	@Override
	public void validate() throws AppException {
		// 最大长度校验
		if (entityCid != null && entityCid.length() > 8) {
			throw new AppException("SY000038","entityCid",String.valueOf(8));//字段[%1]大于最大长度[%2]
		}
		// 非空校验
		if (StringUtils.isEmpty(entityName)) {
			throw new AppException("SY000036","entityName");//字段[%1]为空
		}
		// 最大长度校验
		if (entityName != null && entityName.length() > 60) {
			throw new AppException("SY000038","entityName",String.valueOf(60));//字段[%1]大于最大长度[%2]
		}
		// 非空校验
		if (StringUtils.isEmpty(wkfCode)) {
			throw new AppException("SY000036","wkfCode");//字段[%1]为空
		}
		// 最小长度校验
		if (wkfCode != null && wkfCode.length() < 4) {
			throw new AppException("SY000037","wkfCode",String.valueOf(4));//字段[%1]小于最小长度[%2]
		}
		// 最大长度校验
		if (wkfCode != null && wkfCode.length() > 4) {
			throw new AppException("SY000038","wkfCode",String.valueOf(4));//字段[%1]大于最大长度[%2]
		}
		// 非空校验
		if (StringUtils.isEmpty(businessType)) {
			throw new AppException("SY000036","businessType");//字段[%1]为空
		}
		// 最大长度校验
		if (matchValue != null && matchValue.length() > 2) {
			throw new AppException("SY000038","matchValue",String.valueOf(2));//字段[%1]大于最大长度[%2]
		}
	}
}